﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Csharp类的继承
{
    class Monster
    {
        public string name;

        public Monster(string name) //构造函数有传参
        {
            this.name = name;
        }

        public void Attack()
        {
            Console.WriteLine("{0}攻击了", name);

        }

    }

    class Goblin : Monster
    {
        public Goblin(string name) : base(name) { }//针对构造函数重载后的写法
    }


    class Boss : Monster
    {
        public Boss(string name) : base(name) { }

        public void Skill()
        {
            Console.WriteLine("{0}深深地深吸了一口气",name);
        }
    }
}

